﻿//--------------------------------------
// Copyright     : W.A.I.S. TECHNOLOGY 2003-2008 ; http://www.wais-fr.com ; email: infos@wais-fr.com
// Author        : Henri d'Orgeval
// Contributors  : 
// Last release  : 2007/11/10 (yy/mm/dd)
// Version       : 1.0.0.2
// Pattern       : "Real Time Trace"
// Internal name : ITraceable (RealTimeTrace Interfaces)
// Description   : this file contents all interfaces needed to implement RealTimeTrace
//                 
// Framework     : v2.0.50727 and above
//
// Licence       : Microsoft Permissive Licence
// W.A.I.S provides this code in the hope that it will be useful, but WITHOUT ANY WARRANTY , either express or implied, including but not limited to the implied warranties of merchantability and/or fitness for a particular purpose.          
// This library is free software; you can redistribute it and/or modify it under the terms of the Microsoft Permissive Licence
// The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
//---------------------------------------

using System;
using System.Collections.Generic;
//using System.Linq;
using System.Text;


namespace RealtimeTrace
{
    /// <summary>
    /// Defines the type of data storage for the RealtimeTrace pattern.
    /// </summary>
    [System.Flags()]
    public enum DataProviderType
    {
        /// <summary>
        /// Exceptions are not logged.
        /// </summary>
        None=1,

        /// <summary>
        /// Exceptions are logged into a flat log file.
        /// </summary>
        LogFile=2,

        /// <summary>
        /// Exception are logged into a flag log file on a separate thread;
        /// This option is not yet implemented.
        /// </summary>
        LogFileAsync=4,
    };

    /// <summary>
    /// Defines the type of dump for the object in which an exception has occured.
    /// </summary>
    [System.Flags()]
    public enum DumpType
    {
        /// <summary>
        /// The object in which an exception has occured will be serialiezd to an XML string.
        /// Only public properties will be visible in the data store.
        /// </summary>
        XML = 1,

        /// <summary>
        /// The object in which an exception has occured will be serialized to a binary stream.
        /// </summary>
        Binary  = 2,

        /// <summary>
        /// The object will be in which an exception has occured will be inspected by Relection.
        /// </summary>
        Reflection = 4,
    }
    
    /// <summary>
    /// Interface to be implemented by all client application to enable the RealtimeTrace framework.
    /// </summary>
    public interface Itraceable
    {
        /// <summary>
        /// Gets or Sets the Data Storage provider for the RealtimeTrace framework.
        /// </summary>
        DataProviderType RealTimeTraceProvider { get; set; }

        /// <summary>
        /// Gets or Sets the type of dump to apply to the object in which an exception has occured.
        /// </summary>
        DumpType PreferredDumpType { get; set; }

        ///// <summary>
        /////  This methods renders the content of the current object in the form of a string.
        /////  This string will be added to the trace data store for further analysis.
        ///// </summary>
        ///// <returns></returns>
        //System.String ToDump();

        /// <summary>
        /// Check if one or more errors has occured in the current object.
        /// </summary>
        System.Boolean HasErrors
        {
            get;
            set;
        }

        /// <summary>
        /// Gets the last error message generated by the Real Time Trace 
        /// during the execution of the last method or property.
        /// Use this property to bubble-up the Real Time Trace activity.
        /// </summary>
        System.String LastError
        {
            get;
            set;
        }

        /// <summary>
        /// Gets all error messages generated by the Real Time Trace 
        /// during the execution of the last method or property.
        /// Use this property to bubble-up the Real Time Trace activity.
        /// </summary>
        System.String Errors
        {
            get;
            set;
        }

    }
}
